-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement filter_cookies() with domain-matching and path-matching #7944
Conversation
@Dreamsorcerer Hey buddy. The PR 7777 was closed by force push, creating this new PR to continue. |
for more information, see https://pre-commit.ci
Co-authored-by: Sam Bull <[email protected]>
Co-authored-by: Sam Bull <[email protected]>
Co-authored-by: Sam Bull <[email protected]>
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Co-authored-by: Sam Bull <[email protected]>
for more information, see https://pre-commit.ci
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #7944 +/- ##
==========================================
+ Coverage 97.42% 97.49% +0.07%
==========================================
Files 107 107
Lines 32601 32587 -14
Branches 3799 3799
==========================================
+ Hits 31760 31770 +10
+ Misses 634 614 -20
+ Partials 207 203 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
for more information, see https://pre-commit.ci
@bdraco Made a few more optimisations after looking at codecov. Would be good if you can double check them. |
Starting my day soon, I'll be at my desk in about an hour run through everything |
This looks good. I'll put it on production |
Nothing obvious broke on production. Will do a |
Looks like Will do cProfile instead |
I think this is good to go. |
Backport to 3.10: 💔 cherry-picking failed — conflicts found❌ Failed to cleanly apply 54ceb6f on top of patchback/backports/3.10/54ceb6fd48ff4c4add2107a460376fc72c2b76e9/pr-7944 Backporting merged PR #7944 into master
🤖 @patchback |
) --------- Co-authored-by: Sam Bull <[email protected]> Co-authored-by: J. Nick Koston <[email protected]> (cherry picked from commit 54ceb6f)
) (#7944) --------- Co-authored-by: Sam Bull <[email protected]> Co-authored-by: J. Nick Koston <[email protected]> (cherry picked from commit 54ceb6f) --------- Co-authored-by: xiangxli <[email protected]>
…_cookies (#8537) **This is a backport of PR #8535 as merged into master (7108d64).** <!-- Thank you for your contribution! --> ## What do these changes do? Small speed up to cookiejar Using `str.format` is ~16% faster than the lambda followup to #7944 (comment). I was hoping to use `join` there but later realized `str.format` will take `*args` ## Are there changes in behavior for the user? no ## Is it a substantial burden for the maintainers to support this? no benchmark ```python import timeit import itertools _FORMAT_PATH = "{0}/{1}".format path = "lolonglonglonglonglonglongng/path/to/a/file" print( timeit.timeit( 'itertools.accumulate(path.split("/"), _FORMAT_PATH)', globals=globals() ) ) print( timeit.timeit( 'itertools.accumulate(path.split("/"), lambda x, y: f"{x}/{y}")', globals=globals(), ) ) ``` Co-authored-by: J. Nick Koston <[email protected]>
aiohttp 3.10 and more specifically aio-libs/aiohttp#7944 changed the way cookies are handled. Previously, the domain did not have to be part of the cookie jar for a cookie to be used. As this was changed in 3.10, we now need to pass in the response URL when updating the cookie jar, otherwise the domain will not be part of the stored cookie, and consequently will not be used for the next request. Fixes home-assistant/core#123310.
What do these changes do?
Implement filter_cookies() with domain-matching and path-matching on the keys, instead of testing every single cookie.
Fork from the below PR, force push caused it to be closed.
#7777
Are there changes in behavior for the user?
no
Related issue number
#7583
Checklist
CONTRIBUTORS.txt
CHANGES
folder<issue_id>.<type>
for example (588.bugfix)issue_id
change it to the pr id after creating the pr.feature
: Signifying a new feature..bugfix
: Signifying a bug fix..doc
: Signifying a documentation improvement..removal
: Signifying a deprecation or removal of public API..misc
: A ticket has been closed, but it is not of interest to users.